import java.applet.*;
import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.awt.image.FilteredImageSource;
import java.awt.image.ImageProducer;
import java.net.URLDecoder;

import javax.swing.text.GapContent;


@SuppressWarnings("serial")
public class ImageViewer extends Applet implements MouseListener, KeyListener, MouseMotionListener{
	
	private String param_urls;
	private Image image=null;
	private MediaTracker mediatracker=null;
	
	private String[] urls;
	private int position =0;
	
	private Image dynamic_Iamge;
	
	private int x=0;
	private int y=0;
	
	private int pre_mouse_x=0;
	private int pre_mouse_y=0;
	
	private int current_mouse_x=0;
	private int current_mouse_y=0;
	
	/*
	 * 0 : Auto Size
	 * 1 : Fit Width
	 * 2 : Fit Height
	 * 3 : Specific Rate 
	 */
	
	private int mode=0;
	
	
	public void init() {
		addMouseListener(this); 
		addKeyListener(this);
		addMouseMotionListener(this);
		 
		param_urls=getParameter("param_urls");
		param_urls="http%3A%2F%2Fblogfiles.naver.net%2F20120606_51%2Fneosarchizo_1338965940834_qkW3xD_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28001%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_237%2Fneosarchizo_1338965943347_55ThHp_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28002%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_272%2Fneosarchizo_1338965944829_z8eO8e_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28003%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_298%2Fneosarchizo_1338965945920_ZlT2r8_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28004%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_30%2Fneosarchizo_1338965946929_866F0L_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28005%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_146%2Fneosarchizo_1338965949072_PVr0cw_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28006%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_22%2Fneosarchizo_1338965950927_dO2j3p_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28007%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_48%2Fneosarchizo_1338965952689_O9tKiI_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28008%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_47%2Fneosarchizo_1338965954741_mmVqE0_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28009%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_234%2Fneosarchizo_1338965956375_x99xp7_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28010%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_151%2Fneosarchizo_1338965957790_4Dgncd_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28011%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_13%2Fneosarchizo_1338965959843_5JML0H_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28012%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_224%2Fneosarchizo_1338965962085_5R15i8_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28013%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_134%2Fneosarchizo_1338965964685_0ig675_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28014%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_57%2Fneosarchizo_1338965966791_0nf8FX_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28015%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_16%2Fneosarchizo_1338965968275_H1eTX5_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28016%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_252%2Fneosarchizo_1338965970415_34X7nM_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28017%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_41%2Fneosarchizo_1338965972929_12i598_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28018%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_237%2Fneosarchizo_1338965975263_nCAXdT_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28019%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_66%2Fneosarchizo_1338965977599_fFg44z_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28020%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_296%2Fneosarchizo_1338965979824_vOC67B_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28021%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_43%2Fneosarchizo_1338965982315_WZ7o9A_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28022%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_283%2Fneosarchizo_1338965984258_8pe160_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28023%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_23%2Fneosarchizo_1338965986947_1Rh0Pc_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28024%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_86%2Fneosarchizo_1338965988960_gaqgEI_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28025%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_246%2Fneosarchizo_1338965991883_b7K6wq_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28026%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_226%2Fneosarchizo_1338965994251_6ItvvF_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28027%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_51%2Fneosarchizo_1338965996911_2h9790_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28028%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_57%2Fneosarchizo_1338965998940_W8GFbb_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28029%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_101%2Fneosarchizo_1338966001708_z73h5I_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28030%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_299%2Fneosarchizo_1338966004393_3E8W5A_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28031%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_230%2Fneosarchizo_1338966007025_pz0Sye_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28032%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_224%2Fneosarchizo_1338966009746_3OTvYy_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28033%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_139%2Fneosarchizo_1338966012112_i2GG0r_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28034%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_279%2Fneosarchizo_1338966014099_fFw92e_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28035%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_109%2Fneosarchizo_1338966016101_dW52y1_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28036%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_80%2Fneosarchizo_1338966017909_Yu4jW6_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28037%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_113%2Fneosarchizo_1338966019550_13OuN9_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28038%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_157%2Fneosarchizo_1338966021553_6y4FmO_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28039%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_125%2Fneosarchizo_1338966024298_umZ83p_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28040%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_37%2Fneosarchizo_1338966025787_275mXY_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28041%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_54%2Fneosarchizo_1338966028471_LsyWIu_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28042%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_163%2Fneosarchizo_1338966030085_e91K6n_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28043%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_208%2Fneosarchizo_1338966032124_5zh0yj_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28044%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_262%2Fneosarchizo_1338966034258_dNe2ht_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28045%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_223%2Fneosarchizo_1338966037305_r63bt1_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28046%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_6%2Fneosarchizo_1338966040079_qJ008V_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28047%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_161%2Fneosarchizo_1338966042774_gY3mKA_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28048%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_248%2Fneosarchizo_1338966044784_HZjU8h_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28049%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_231%2Fneosarchizo_1338966045915_g07Iw4_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28050%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_100%2Fneosarchizo_1338966046826_42V7lu_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28051%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_121%2Fneosarchizo_1338966048924_dff4iD_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28052%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_94%2Fneosarchizo_1338966051394_rFXN0o_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28053%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_220%2Fneosarchizo_1338966054066_3BGyMu_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28054%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_84%2Fneosarchizo_1338966057107_2VcA7R_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28055%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_207%2Fneosarchizo_1338966059789_df2oLZ_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28056%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_286%2Fneosarchizo_1338966062455_wO4K15_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28057%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_190%2Fneosarchizo_1338966064541_Nx5J1B_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28058%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_152%2Fneosarchizo_1338966066646_Bcz0Sj_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28059%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_31%2Fneosarchizo_1338966069246_12g4dw_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28060%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_84%2Fneosarchizo_1338966071331_VMzLO5_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28061%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_157%2Fneosarchizo_1338966073356_IY4FWp_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28062%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_256%2Fneosarchizo_1338966075583_IGr5DJ_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28063%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_109%2Fneosarchizo_1338966076960_060W6L_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28064%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_286%2Fneosarchizo_1338966078462_pB50EP_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28065%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_229%2Fneosarchizo_1338966081076_gwJd8C_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28066%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_279%2Fneosarchizo_1338966084115_u2fP6B_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28067%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_52%2Fneosarchizo_1338966086350_A2r7th_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28068%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_131%2Fneosarchizo_1338966088808_hi2Yol_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28069%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_35%2Fneosarchizo_1338966091267_0o8BJP_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28070%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_262%2Fneosarchizo_1338966093781_l24CzW_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28071%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_287%2Fneosarchizo_1338966095817_7DX1TP_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28072%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_145%2Fneosarchizo_1338966098245_xw68O2_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28073%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_220%2Fneosarchizo_1338966100694_YCIH0k_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28074%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_229%2Fneosarchizo_1338966103472_ZZn52F_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28075%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_137%2Fneosarchizo_1338966105587_Uf65Bm_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28076%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_43%2Fneosarchizo_1338966107485_F166z8_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28077%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_38%2Fneosarchizo_1338966109852_qnh45U_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28078%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_73%2Fneosarchizo_1338966111905_0b3zEd_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28079%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_266%2Fneosarchizo_1338966114252_45683z_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28080%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_121%2Fneosarchizo_1338966117079_gsA470_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28081%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_67%2Fneosarchizo_1338966119717_Aru98P_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28082%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_158%2Fneosarchizo_1338966122124_00384L_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28083%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_267%2Fneosarchizo_1338966124577_SL5xm6_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28084%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_270%2Fneosarchizo_1338966126619_0c2HYp_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28085%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_281%2Fneosarchizo_1338966128832_tSekhc_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28086%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_264%2Fneosarchizo_1338966130168_YV39xm_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28087%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_141%2Fneosarchizo_1338966131673_4Kmc7g_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28088%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_71%2Fneosarchizo_1338966135136_1Nt3Gt_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28089%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_186%2Fneosarchizo_1338966137489_9ZsF1o_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28090%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_84%2Fneosarchizo_1338966140045_HlfjuP_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28091%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_296%2Fneosarchizo_1338966142643_ZoZ969_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28092%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_95%2Fneosarchizo_1338966145620_l4IF1d_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28093%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_189%2Fneosarchizo_1338966148495_bnVj60_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28094%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_235%2Fneosarchizo_1338966151186_P0LyHE_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28095%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_220%2Fneosarchizo_1338966153218_Nn2w90_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28096%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_79%2Fneosarchizo_1338966155409_oez6g1_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28097%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_133%2Fneosarchizo_1338966156552_7PIH10_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28098%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_283%2Fneosarchizo_1338966158440_47jIM5_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28099%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_170%2Fneosarchizo_1338966160779_n9iW95_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28100%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_118%2Fneosarchizo_1338966163118_345rbb_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28101%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_97%2Fneosarchizo_1338966165171_Lu4tlh_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28102%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_285%2Fneosarchizo_1338966167130_2zc5jh_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28103%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_19%2Fneosarchizo_1338966169847_DrVIY0_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28104%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_85%2Fneosarchizo_1338966172315_5El0R9_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28105%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_116%2Fneosarchizo_1338966174569_o2U60U_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28106%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_146%2Fneosarchizo_1338966176155_S69FK5_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28107%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_120%2Fneosarchizo_1338966179125_Sb6sI2_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28108%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_92%2Fneosarchizo_1338966180506_13v84Y_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28109%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_75%2Fneosarchizo_1338966183022_zRleMG_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28110%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_256%2Fneosarchizo_1338966185354_jmHd0P_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28111%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_300%2Fneosarchizo_1338966187743_b0o548_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28112%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_36%2Fneosarchizo_1338966190114_EG5SpQ_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28113%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_190%2Fneosarchizo_1338966192224_s9mrmf_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28114%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_228%2Fneosarchizo_1338966194799_dcJ1Ju_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28115%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_15%2Fneosarchizo_1338966197114_s2DY1C_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28116%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_20%2Fneosarchizo_1338966199424_welnot_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28117%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_245%2Fneosarchizo_1338966201314_cfoPyx_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28118%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_44%2Fneosarchizo_1338966203619_225w86_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28119%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_27%2Fneosarchizo_1338966205924_S8wJOV_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28120%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_197%2Fneosarchizo_1338966207399_703cjP_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28121%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_199%2Fneosarchizo_1338966209628_m5HFR7_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28122%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_171%2Fneosarchizo_1338966212688_HnpQoj_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28123%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_254%2Fneosarchizo_1338966214145_Hn0Tb0_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28124%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_67%2Fneosarchizo_1338966216275_5nNEz7_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28125%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_98%2Fneosarchizo_1338966219067_v1Nx22_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28126%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_192%2Fneosarchizo_1338966222254_az3tlc_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28127%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_27%2Fneosarchizo_1338966224865_M4HEXv_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28128%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_275%2Fneosarchizo_1338966227141_ktE8vO_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28129%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_166%2Fneosarchizo_1338966230129_6n1fdR_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28130%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_50%2Fneosarchizo_1338966232892_X6qx9y_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28131%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_227%2Fneosarchizo_1338966236095_aOBd8x_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28132%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_220%2Fneosarchizo_1338966238740_vvrxL4_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28133%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_27%2Fneosarchizo_1338966241121_4Nq4M8_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28134%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_159%2Fneosarchizo_1338966243259_3QsK48_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28135%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_74%2Fneosarchizo_1338966244919_96C9U9_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28136%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_283%2Fneosarchizo_1338966246959_mB7jV6_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28137%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_38%2Fneosarchizo_1338966250053_e1K2FM_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28138%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_257%2Fneosarchizo_1338966252533_W9aKI0_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28139%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_238%2Fneosarchizo_1338966255111_q9WM1a_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28140%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_10%2Fneosarchizo_1338966257646_uUgU0H_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28141%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_279%2Fneosarchizo_1338966259804_ke7tpo_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28142%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_216%2Fneosarchizo_1338966262714_mdfyAh_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28143%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_160%2Fneosarchizo_1338966264899_40G2N5_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28144%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_248%2Fneosarchizo_1338966267648_PAatOH_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28145%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_147%2Fneosarchizo_1338966271114_31a0EU_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28146%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_216%2Fneosarchizo_1338966273440_kDRosr_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28147%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_133%2Fneosarchizo_1338966276239_23L10U_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28148%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_261%2Fneosarchizo_1338966278809_GvL0fw_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28149%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_196%2Fneosarchizo_1338966281383_02J1Y7_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28150%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_288%2Fneosarchizo_1338966283160_jB8k8x_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28151%29.jpg]http%3A%2F%2Fblogfiles.naver.net%2F20120606_104%2Fneosarchizo_1338966285114_mqZ16I_jpg%2FHarvard%2520Business%2520Review%2520-%252006%25202012%2520%28152%29.jpg";
		urls = param_urls.split("]");
		for(int i=0;i<urls.length;i++){
			try{
				urls[i] = URLDecoder.decode(urls[i],"UTF-8");
			}catch(Exception e){
				
			}
		}
		
		loadImage();
		
		/*
		char c='a';
		System.out.println((int)c);
		c='A';
		System.out.println((int)c);
		c='w';
		System.out.println((int)c);
		c='W';
		System.out.println((int)c);
		*/
		//97 65 119 87
	}
	
	/*
	public void update(Graphics g) {
		// Don't repaint background, it only slow applet down
	    //paint(g);
	}
	*/
	
	public void paint(Graphics g) {
		
		Graphics2D g2 = (Graphics2D)g;
		
		setBackground(new Color(0,0,0));
		
		int width = getWidth();
		int height = getHeight();
		
		int image_width = image.getWidth(null);
		int image_height = image.getHeight(null);
		
		g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, // Anti-alias!
		        RenderingHints.VALUE_INTERPOLATION_BICUBIC);
		
		int y_gap=0;
		
		switch(mode){
		case 0: //Auto Size
			if(image_width>width || image_height>height){
				double rate;
				if(height>width){
					if((double)image_width/(double)image_height <(double)width/(double)height){
						rate=(double)image_width/(double)image_height;
						g2.drawImage(image,(int)(width-(height*rate))/2,0,(int)(height*rate),height,null);
					}else{
						rate=(double)image_height/(double)image_width;
						g2.drawImage(image,0,(int)(height-(width*rate))/2,width,(int)(width*rate),null);
					}
				}else{
					if((double)image_height/(double)image_width <(double)height/(double)width){
						rate=(double)image_height/(double)image_width;
						g2.drawImage(image,0,(int)(height-(width*rate))/2,width,(int)(width*rate),null);
					}else{
						rate=(double)image_width/(double)image_height;
						g2.drawImage(image,(int)(width-(height*rate))/2,0,(int)(height*rate),height,null);
					}
				}
			}else{
				//center
				g2.drawImage(image, (width/2)-(image_width/2), (height/2)-(image_height/2), null);
			}
			break;
		case 1: //Fit Width
			double rate;
			rate=(double)image_height/(double)image_width;
			
			g2.drawImage(image,0,y,width,(int)(width*rate),null);
			break;
		}
		
		g=g2;
		
		
		
	}
	 
	public void setString(String aString) {
		loadImage();
	}
	 
	public void loadImage(){
		mediatracker = new MediaTracker(this);
		image = getImage(getDocumentBase(),urls[position]);
		
		mediatracker.addImage(image, 0);
		
		try
		{
			mediatracker.waitForAll();
		}
		catch (Exception e)	{};
	}
	
	@Override
	public void mouseClicked(MouseEvent e) {
		switch(e.getModifiers()) {
	      case InputEvent.BUTTON1_MASK: 
	        //Left
	    	++position;
	  		if(position>=urls.length){
	  			position=0;
	  		}
	        break;
	      case InputEvent.BUTTON2_MASK: 
	        //Middle     
	        break;
	      case InputEvent.BUTTON3_MASK: 
	        //Right
	    	--position;
	  		if(position<0){
	  			position=urls.length-1;
	  		}
	        break;
		}
		
		x=0;
		y=0;
		pre_mouse_x=0;
		pre_mouse_y=0;
		loadImage();
		repaint();
	}

	@Override
	public void mouseEntered(MouseEvent e) {
		
		
	}

	@Override
	public void mouseExited(MouseEvent e) {
		
		
	}

	@Override
	public void mousePressed(MouseEvent e) {
		pre_mouse_x=e.getX();
		pre_mouse_y=e.getY();
		
	}

	@Override
	public void mouseReleased(MouseEvent e) {
		
	}
	
	public void keyPressed( KeyEvent e ) { }
	
	public void keyReleased( KeyEvent e ) { }
	
	public void keyTyped( KeyEvent e ) {
	      char c = e.getKeyChar();
	      if ( c != KeyEvent.CHAR_UNDEFINED ) {
	         int int_c = (int)c;
	         if(int_c==97 || int_c==65){
	        	 //a || A
	        	 if(mode!=0){
	        		 mode=0;
		        	 repaint();
	        	 }
	         }else if(int_c==119 || int_c==87){
	        	 //w || W
	        	 if(mode!=1){
	        		 mode=1;
		        	 pre_mouse_y=0;
		        	 current_mouse_y=0;
	        		 y=0;
		        	 repaint();
	        	 }
	         }
	    	 
	      }
	}
	
	public void mouseMoved(MouseEvent me)  
    {  

    }

    public void mouseDragged(MouseEvent me)  
    {
    	switch(mode){
    	case 1:
    		current_mouse_y=me.getY();
    		y+=current_mouse_y-pre_mouse_y;
			pre_mouse_y=current_mouse_y;
			if(y>0){
				y=0;
			}
    		repaint();
    		break;
    	}
    }
	
	
}
